﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.ServiceModel.DomainServices.Client;
using System.Windows.Data;
using System.ComponentModel;

namespace Sanctuary
{
    public partial class EmployeeDialog : Page
    {
        public EmployeeDialog()
        {
            InitializeComponent();
            this.DataContext = this;
        }
        //GameTestDomainContext context = new GameTestDomainContext();

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }


        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //LoadOperation<Employee> loadOp = this.context.Load(this.context.GetEmployeesQuery());

            //CollectionViewSource collectionViewSource = new CollectionViewSource();
            //collectionViewSource.Source = loadOp.Entities;
            //ICollectionView dataView = collectionViewSource.View;
            //listBoxEmployees.ItemsSource = dataView;
        }

        private void SortTheData(object sender, RoutedEventArgs e)
        {
            if (listBoxEmployees != null)
            {
                ICollectionView dataView = (ICollectionView)listBoxEmployees.ItemsSource;

                dataView.SortDescriptions.Clear();
                dataView.SortDescriptions.Add(
                  new SortDescription(((RadioButton)sender).Tag.ToString(),
                    ListSortDirection.Descending));

                listBoxEmployees.ItemsSource = dataView;
            }
        }
    }
}
